package cn.jbolt.common.gen;

import java.awt.CardLayout;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.UIManager;

public class JBoltGeneratorGUI {

	private JFrame frmJbolt;
	private JTextField textField;
	private JTextField txtRoot;
	private JTextField txtRoot_1;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					JBoltGeneratorGUI window = new JBoltGeneratorGUI();
					window.frmJbolt.setVisible(true);
					String lookAndFeel = UIManager.getSystemLookAndFeelClassName();
					UIManager.setLookAndFeel(lookAndFeel);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public JBoltGeneratorGUI() {
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frmJbolt = new JFrame();
		frmJbolt.setTitle("JBolt极速开发平台-代码生成器");
		frmJbolt.setBounds(100, 100, 800, 320);
		frmJbolt.setResizable(false);
		frmJbolt.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frmJbolt.getContentPane().setLayout(new CardLayout(0, 0));
		
		JPanel dataSourcePanel = new JPanel();
		frmJbolt.getContentPane().add(dataSourcePanel, "name_1483464853807900");
		dataSourcePanel.setLayout(null);
		
		JLabel lbljbolt = new JLabel("配置JBolt生成器数据源");
		lbljbolt.setBounds(287, 17, 189, 21);
		lbljbolt.setFont(new Font("宋体", Font.PLAIN, 18));
		lbljbolt.setHorizontalAlignment(SwingConstants.CENTER);
		dataSourcePanel.add(lbljbolt);
		
		JLabel label_1 = new JLabel("可选列表：");
		label_1.setHorizontalAlignment(SwingConstants.RIGHT);
		label_1.setBounds(28, 59, 82, 15);
		dataSourcePanel.add(label_1);
		
		JComboBox<String> comboBox = new JComboBox<String>();
		comboBox.setBounds(116, 56, 114, 21);
		comboBox.setModel(new DefaultComboBoxModel<String>(new String[] {"main", "jfinalxueyuan"}));
		dataSourcePanel.add(comboBox);
		
		JLabel label_2 = new JLabel("数据库类型：");
		label_2.setBounds(246, 59, 91, 15);
		dataSourcePanel.add(label_2);
		
		JComboBox<String> comboBox_1 = new JComboBox<String>();
		comboBox_1.setBounds(343, 56, 114, 21);
		comboBox_1.setModel(new DefaultComboBoxModel<String>(new String[] {"Mysql", "SqlServer", "Oracle", "Postgresql"}));
		dataSourcePanel.add(comboBox_1);
		
		JLabel lblJdbcurl = new JLabel("JDBC_URL：");
		lblJdbcurl.setHorizontalAlignment(SwingConstants.RIGHT);
		lblJdbcurl.setBounds(28, 87, 82, 15);
		dataSourcePanel.add(lblJdbcurl);
		
		textField = new JTextField();
		textField.setBounds(116, 84, 580, 21);
		dataSourcePanel.add(textField);
		textField.setColumns(10);
		
		JLabel lblUser = new JLabel("User：");
		lblUser.setHorizontalAlignment(SwingConstants.RIGHT);
		lblUser.setBounds(28, 115, 82, 15);
		dataSourcePanel.add(lblUser);
		
		txtRoot = new JTextField();
		txtRoot.setBounds(116, 112, 227, 21);
		txtRoot.setText("root");
		dataSourcePanel.add(txtRoot);
		txtRoot.setColumns(10);
		
		JLabel lblPassword = new JLabel("Password：");
		lblPassword.setHorizontalAlignment(SwingConstants.RIGHT);
		lblPassword.setBounds(28, 143, 82, 15);
		dataSourcePanel.add(lblPassword);
		
		txtRoot_1 = new JTextField();
		txtRoot_1.setBounds(116, 140, 227, 21);
		txtRoot_1.setText("root");
		dataSourcePanel.add(txtRoot_1);
		txtRoot_1.setColumns(10);
		
		JButton btnTest = new JButton("测试连接");
		btnTest.setBounds(116, 200, 120, 26);
		dataSourcePanel.add(btnTest);
		
		JButton btnNewButton = new JButton("Model生成器");
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
			}
		});
		btnNewButton.setBounds(246, 200, 120, 26);
		dataSourcePanel.add(btnNewButton);
		
		JButton btnNewButton_1 = new JButton("主逻辑生成器");
		btnNewButton_1.setBounds(376, 200, 120, 26);
		dataSourcePanel.add(btnNewButton_1);
	}

}
